package com.igoal.utils;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

public class CookieMap {
	private Map<String, String> cookieMap = new HashMap<String, String>();

	public CookieMap(HttpServletRequest request) {
		Cookie[] cookies = request.getCookies();
		if (cookies != null) {
			for (Cookie c : cookies) {
				if (c != null) {
					String cookieName = c.getName();
					String cookieValue = c.getValue();
					cookieMap.put(cookieName, cookieValue);
				}
			}
		}
	}

	public String get(String name) {
		return cookieMap.get(name);
	}
}
